#pragma once

#include "deadz80/deadZ80.h"
#include "VSystem.h"
#include "VDP.h"

class CSMS
{
protected:
	CDeadZ80 z80;
	CVDP vdp;
	CVSystem sys;
	u8 *rom;
	int romsize;
	u8 wram[0x2000];
public:
	CSMS();
	~CSMS();

	int Load(char *fn);
	void Unload();

	void Reset(int hard = 0);
	void Frame();
	void Step();

	u32 GetPC(){return(z80.GetPC());}
	u32 Disassemble(u32 p,char *str){return(z80.Disassemble(str,p));}
	char *GenerateRegNames(){static char buf[1024];return(z80.GenerateRegNames(buf));}
	char *GenerateRegData(){static char buf[1024];return(z80.GenerateRegData(buf));}

	static u8 ioread(void *user,u32 addr);
	static void iowrite(void *user,u32 addr,u8 data);
	static void pagingwrite(void *user,u32 addr,u8 data);
};
